export const PRIORITIES = {
  NONE: 0,
  LOW: 1,
  MEDIUM: 2,
  HIGH: 3
};

export const PRIORITY_CONFIG = {
  [PRIORITIES.NONE]: { text: '无', color: '#94A3B8', icon: '' },        // Adjusted Gray for Dark Theme
  [PRIORITIES.LOW]: { text: '低', color: '#34D399', icon: '!', altIcon: '•' },      // Adjusted Green (Emerald 400)
  [PRIORITIES.MEDIUM]: { text: '中', color: '#FBBF24', icon: '!!', altIcon: '•' },   // Adjusted Yellow (Amber 400)
  [PRIORITIES.HIGH]: { text: '高', color: '#F87171', icon: '!!!', altIcon: '•' },  // Adjusted Red (Red 400)
};

export function getPriorityText(priority) {
  const config = PRIORITY_CONFIG[priority];
  return (config && typeof config.text !== 'undefined') ? config.text : PRIORITY_CONFIG[PRIORITIES.NONE].text;
}

export function getPriorityColor(priority) {
  const config = PRIORITY_CONFIG[priority];
  return (config && typeof config.color !== 'undefined') ? config.color : PRIORITY_CONFIG[PRIORITIES.NONE].color;
}

export function getPriorityIcon(priority, useAltIcon = true) { 
  if (priority === PRIORITIES.NONE) return ''; 
  const config = PRIORITY_CONFIG[priority];
  if (!config) return ''; 
  
  // If useAltIcon is true (meaning we want a CSS-drawn dot), 
  // return empty string for non-NONE priorities.
  // The actual dot will be rendered by CSS background/border on the span.
  if (useAltIcon && priority !== PRIORITIES.NONE) {
    return ''; // Let CSS handle the dot
  }
  
  // If useAltIcon is false, or if it's NONE (which has no altIcon by default)
  // use the configured icon (e.g., "!", "!!", "!!!")
  const iconToUse = useAltIcon ? config.altIcon : config.icon; // This line might seem redundant now for useAltIcon=true case
                                                            // but PRIORITY_CONFIG still holds altIcon:'•'
                                                            // Let's refine:
  if (useAltIcon) {
    return priority === PRIORITIES.NONE ? '' : ''; // For NONE, no icon text. For others, CSS will draw.
  } else {
    // use textual icon like !, !!
    return (config && typeof config.icon !== 'undefined') ? config.icon : '';
  }
} 